package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	ItemMainEventNew           = "wms.ItemMainNew"
	ItemMainEventBeforeCreate  = "wms.ItemMainBeforeCreate"
	ItemMainEventBeforeUpdate  = "wms.ItemMainBeforeUpdate"
	ItemMainEventBeforeSave    = "wms.ItemMainBeforeCreate wms.ItemMainBeforeUpdate"
	ItemMainEventAfterCreate   = "wms.ItemMainAfterCreate"
	ItemMainEventAfterUpdate   = "wms.ItemMainAfterUpdate"
	ItemMainEventAfterSave     = "wms.ItemMainAfterCreate wms.ItemMainAfterUpdate"
	ItemMainEventDelete        = "wms.ItemMainDelete"
	ItemMainAccessControlEvent = "wms.ItemMainAccessControl"
)

func GetItemMainConfig() *mgo.DocConfig {
	return ItemMain_Config
}

var ItemMain_Config *mgo.DocConfig

func init() {
	ItemMain_Config = NewItemMainConfig()
}
func NewItemMainConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.ItemMain",
		Fields: []string{
			"item", "skuText", "skuCode", "num", "cost", "note",
		},
		RelationFields: []string{
			"item",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"item": {
				Config:     GetItemSkuConfig,
				DocName:    "ItemSku",
				JoinType:   "O",
				KeyInside:  "itemId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
